package com.supostacks.domain.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.supostacks.domain.repository.IFeedbackRepository;
import com.supostacks.domain.repository.IGetRecordsRepository;
import com.supostacks.domain.service.IFeedbackService;
import com.supostacks.domain.service.IGetRecordsService;
import com.supostacks.domain.vo.GetRecordsVo;
import com.supostacks.domain.vo.GetRecordsVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class GetRecordsServiceImpl implements IGetRecordsService {
    @Resource
    private IGetRecordsRepository getRecordsRepository;

    @Override
    public String insert(GetRecordsVo getRecordsVo) {
        return getRecordsRepository.insert(getRecordsVo);
    }

    @Override
    public void deleteById(String id) {
        getRecordsRepository.deleteById(id);
    }

    @Override
    public String updateById(GetRecordsVo getRecordsVo) {
        return getRecordsRepository.updateById(getRecordsVo);
    }

    @Override
    public GetRecordsVo selectById(String id) {
        return getRecordsRepository.selectById(id);
    }

    @Override
    public List<GetRecordsVo> selectList(JSONObject param) {
        List<GetRecordsVo> getRecordsVos = getRecordsRepository.selectList(param);
        return new ArrayList<>(getRecordsVos);
    }

    @Override
    public JSONObject selectByPage(JSONObject param,int pageNo,int pageSize) {
        return getRecordsRepository.selectByPage(param,param.getInteger("pageNo"),param.getInteger("pageSize"));
    }

}
